#include <string>
#include <vector>
#include <iostream>
#include "args.hpp"

using namespace std;

bool getArgExists(int argc, char **argv, string argName, bool print) {
  for(int i = 1; i < argc; i++) {
    if(argv[i] == argName) {
      if (print) {
        cout << "Arg " << argName << " exists" << "\n";
      }
      return true;
    }
  }
  return false;
}

vector<string> getArgValues(int argc, char **argv, string argName, bool print) {
  bool argFound = false;
  vector<string> result;
  for(int i = 1; i < argc; i++) {
    if(argFound && string(argv[i]).substr(0,1) != "-") {
      if(print) {
        cout << "Found arg under " << argName << ": " << argv[i] << "\n";
      }
      result.push_back(argv[i]);
    } else {
      argFound = false;
    }
    if(argv[i] == argName) {
      argFound = true;
    }
  }
  return result;
}
